package hmis.pos.Entity;

import hmis.pos.Base.BaseEntity.BaseEntity;

import javax.persistence.*;

@Entity
@Table(name="orderdetail")
public class OrderDetail extends BaseEntity {

    //多个订单明细对应一个订单
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name="orderid",referencedColumnName = "id",insertable = false,updatable = false)
    private Order order;

    //对应的订单号
    @Column(name="orderid",nullable = false)
    private String orderid;

    //预订的房间类型
    @Column(name="type",nullable = false)
    private String type;

    //预订的房间数量
    @Column(name="roomnumber",nullable = false)
    private int roomnumber;

    //小计金额
    @Column(name="subtotal",nullable = false)
    private double subtotal;

    //订单详情的状态---已安排/待安排/已完成
    @Column(name="status",nullable = false)
    private String status;


    public Order getOrder() {
        return order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    public String getOrderid() {
        return orderid;
    }

    public void setOrderid(String orderid) {
        this.orderid = orderid;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int getRoomnumber() {
        return roomnumber;
    }

    public void setRoomnumber(int roomnumber) {
        this.roomnumber = roomnumber;
    }

    public double getSubtotal() {
        return subtotal;
    }

    public void setSubtotal(double subtotal) {
        this.subtotal = subtotal;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public String toString() {
        return "OrderDetail{" +
                "order=" + order +
                ", orderid='" + orderid + '\'' +
                ", type='" + type + '\'' +
                ", roomnumber=" + roomnumber +
                ", subtotal=" + subtotal +
                ", status='" + status + '\'' +
                '}';
    }
}
